﻿using System;
using System.ServiceModel;

namespace Universe.WCF.Behaviors.Test
{
    [ServiceBehavior(IncludeExceptionDetailInFaults = true, InstanceContextMode = InstanceContextMode.Single)]
    public class Service1<T> : IService1<T>
    {
        public string GetData(int value, Type type)
        {
            return string.Format("You entered: {0}", value);
        }

        public CompositeType GetData(CompositeType composite)
        {
            if (composite.BoolValue)
            {
                composite.StringValue = composite.StringValue + " " + composite.StringValue;
            }
            return composite;
        }

        public void ThrowException(string message)
        {
            Exception inner = new InvalidOperationException("HEHEHE!");
            throw new ApplicationException(message, inner);
        }
    }
}